package demo2;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-08-05
 * Time: 20:23
 */

class Number {
    public int num = 0;

}

public class thread2 {

    public static void main(String[] args) {

        Number number = new Number();

        Thread t1 = new Thread(() -> {
            while (number.num == 0) {

            }

            System.out.println("t1 线程执行完毕");
        });

        Thread t2 = new Thread(() -> {
            Scanner scanner = new Scanner(System.in);
            System.out.println("给 num 输入一个整数 : ");
            number.num = scanner.nextInt();
        });

        t1.start();
        t2.start();
    }
}
